Linux | Codecov |
---|---|
Fang-Oosterlee Library for Rust
Implements Fang-Oosterlee algorithm in Rust. While the algorithm originally was used for option pricing, it can be used for a variety of use cases. For example, it can be used to compute the Value at Risk of a distribution, the density of a distribution, and the partial expectation.
It requires a characteristic function computed at various specific intervals. A utility function is provided which converts an analytical characteristic function into a vector.
Documentation is at docs.rs
Use
Put the following in your Cargo.toml:
[]
= "0.13"
Import and use:
extern crate num_complex;
extern crate fang_oost;
extern crate rayon;
use *;
use Complex;
let num_x = 1024;
let num_u = 256;
let x_min = -20.0;
let x_max = 25.0;
let mu=2.0;
let sigma:f64=5.0;
let norm_cf = ;
let x_domain= get_x_domain;
//computes discrete gaussian characteristic function
let discrete_cf= get_discrete_cf;
let density: = get_density.collect;